package com.lzy.cloud.goods.service.GoodsServiceImpl;

import com.lzy.cloud.goods.dtos.CarParamAppDto;
import com.lzy.cloud.goods.dtos.CarParamDto;
import com.lzy.cloud.goods.entity.CarParam;
import com.lzy.cloud.goods.mapper.CarParamMapperExt;
import com.lzy.cloud.goods.service.CarParamService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by WIN7 on 2018/6/9.
 */
@Service
public class CarParamServiceImpl implements CarParamService{

    @Autowired
    CarParamMapperExt carParamMapperExt;

    @Override
    public Boolean add(CarParamDto dto) {
        return carParamMapperExt.insertSelective(DozerUtils.map(dto,CarParam.class))>0;
    }

    @Override
    public Boolean delById(Long id) {
        return carParamMapperExt.deleteByPrimaryKey(id)>0;
    }

    @Override
    public Boolean delByKey(CarParamDto dto) {
        return carParamMapperExt.delByKey(dto)>0;
    }

    @Override
    public Boolean update(CarParamDto dto) {
        return carParamMapperExt.updateByPrimaryKeySelective(DozerUtils.map(dto,CarParam.class))>0;
    }

    @Override
    public List<CarParamDto> selectList(CarParamDto dto) {
        return carParamMapperExt.selectList(dto);
    }

    @Override
    public CarParamDto selectById(Long id) {
        return DozerUtils.map(carParamMapperExt.selectByPrimaryKey(id),CarParamDto.class);
    }

    @Override
    public Boolean delByKeyTrue(CarParamDto carParamDto) {
        return carParamMapperExt.delByKeyTrue(carParamDto)>0;
    }

    @Override
    public List<CarParamDto> selectCoreValue(CarParamDto carParamDto) {
        return carParamMapperExt.selectCoreValue(carParamDto);
    }

    @Override
    public List<CarParamAppDto> findCore(Long sourceId) {
        return carParamMapperExt.findCore(sourceId);
    }
}
